package com.BCM.service.impl;


import com.BCM.dao.UserDao;
import com.BCM.po.User;

import com.BCM.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author tanghao
 */
@Service
public class UserImpl implements UserService {
    @Autowired
    private UserDao userDao;

    @Override
    public List<User> findAllUser() {
        return this.userDao.findAllUser();
    }

    @Override
    public int deleteUser(int id) {
        int num=this.userDao.deleteUser(id);
        return num;
    }

    @Override
    public User findUserById(int id) {
        return this.userDao.findUserById(id);
    }

    @Override
    public int updateUser(User user) {
        return this.userDao.updateUser(user);
    }

    @Override
    public void save(User user) {
        userDao.save(user);
    }

    @Override
    public List<User> findUserBystudentClass(String studentClass) {
        List<User> users=this.userDao.findUserBystudentClass(studentClass);
        for (User user:users){
            System.out.println("service"+user);
        }
        return users;
    }
}
